import { _decorator, Component, find, Label, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('Score')
export class Score extends Component {

    private player:Node = null
    score:number = 0
    start() {
        this.player = find('Canvas/MainLogic/Player')
    }

    update(deltaTime: number) {
        this.score = Math.round(this.player.position.x/100)
        this.node.getComponent(Label).string = this.score.toString()
    }
}


